﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RoleRepository.cs" company="">
//   Copyright (c) 2010/2011 All Right Reserved
// </copyright>
// <summary>
//   Contains RoleRepository class declaration.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace iBuproModel.Repositories.Classes
{
    using System.Collections.Generic;
    using System.Linq;

    using iBuproModel.Repositories.Interfaces;

    /// <summary>
    /// Implements IRoleRepository interface using linq to entities.
    /// </summary>
    public class RoleRepository : GenericRepository<Role>, IRoleRepository
    {
        public List<User> GetLectors()
        {
            return context.Roles.First(r => r.Name == "Lector").Users.ToList();
        }

        public List<User> GetStudents()
        {
            return context.Roles.First(r => r.Name == "Student").Users.ToList();
        }

        public List<User> GetPrincipals()
        {
            return context.Roles.First(r => r.Name == "Principal").Users.ToList();
        }

        public List<User> GetAdmins()
        {
            return context.Roles.First(r => r.Name == "Admin").Users.ToList();
        }
    }
}
